package com.hoas.quickstart.threads.chapter02.chapter02_2_8_03;

public class Run {

    public static void main(String[] args) {

        System.out.println("结论1：当其他线程执行x对象中synchronized(x){}代码块时呈现同步效果 ");

        Service service = new Service();
        MyObject object = new MyObject();

        ThreadA a  = new ThreadA(service, object);
        a.setName("a");
        a.start();

        try {
            Thread.sleep(200);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        ThreadB b  = new ThreadB(service, object);
        b.setName("b");
        b.start();


    }

}
